part of '../../repository.dart';

class _GooglePlayPurchasedSubscriptionCancellationInfoDtoFactory {
  const _GooglePlayPurchasedSubscriptionCancellationInfoDtoFactory._internal();

  static const _instance = _GooglePlayPurchasedSubscriptionCancellationInfoDtoFactory._internal();

  factory _GooglePlayPurchasedSubscriptionCancellationInfoDtoFactory() {
    return _instance;
  }

  _GooglePlayPurchasedSubscriptionCancellationInfoDto fromJson(Map<String, dynamic> json) {
    final cancellationInfoType =
        json[_kGooglePlayPurchasedSubscriptionCancellationInfoTypeKey] as String;

    switch (cancellationInfoType) {
      case _kGooglePlayPurchasedSubscriptionUserCancellationInfoTypeValue:
        return _GooglePlayPurchasedSubscriptionUserCancellationInfoDto.fromJson(json);
      case _kGooglePlayPurchasedSubscriptionSystemCancellationInfoTypeValue:
        return const _GooglePlayPurchasedSubscriptionSystemCancellationInfoDto();
      case _kGooglePlayPurchasedSubscriptionDeveloperCancellationInfoTypeValue:
        return const _GooglePlayPurchasedSubscriptionDeveloperCancellationInfoDto();
      case _kGooglePlayPurchasedSubscriptionNewSubscriptionCancellationInfoTypeValue:
        return const _GooglePlayPurchasedSubscriptionNewSubscriptionCancellationInfoDto();
      default:
        throw UnimplementedError();
    }
  }
}
